<template>
  <div>
    <v-chart :forceFit="true" :height="height" :data="sourceData" :scale="scale">
      <v-tooltip />
      <v-axis />
      <v-line position="year*value" />
      <v-point position="year*value" shape="circle" />
    </v-chart>
  </div>
</template>

<script lang="ts">
import { Component, Vue, Prop, Emit } from "vue-property-decorator";
@Component({
  name: "chart-line",

  layout: "menu"
})
export default class ChartLine extends Vue {
  @Prop({ type: Array, required: true }) sourceData!: any[];
  @Prop({ type: String }) alias?: string;
  @Prop({ type: Number, default: 400 }) height?: number;
  scale: any[] = [
    {
      dataKey: "value",
      alias: this.alias ? this.alias : "",
      min: 0
    },
    {
      dataKey: "year",
      min: 0,
      max: 1
    }
  ];
}
</script>

<style lang='less' scoped>
</style>